<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>hide</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .container {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
        }

        .wrap-item {
            border: 1px solid #dedede;
            background: linear-gradient(135deg, #9495e9 10%, #3d35e2 90%);
            margin: 8px;
            padding: 5px;
            border-radius: 4px;
            width: 200px;
            height: 200px;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #fff;
            font-size: 18px;
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
            letter-spacing: 2px;
        }

        .wrap-item::after {
            content: attr(data-text);
        }

        .wrap-item-img {
            object-fit: cover;
            width: 100%;
            height: 100%;
            border-radius: 4px;
        }
    </style>
</head>

<body>
    <div id="container" class="container"></div>
    <script>
        const BASE_URL = "https://www.eveningwater.com/my-web-projects/jQuery/7/img/";
        const createWrap = (wrap) => new Promise((resolve) => {
            for (let i = 0; i < 10; i++) {
                const item = document.createElement("div");
                item.className = `wrap-item`;
                item.innerHTML = `<img class='wrap-item-img' src="${BASE_URL + (i + 1)}.jpg">`;
                wrap.appendChild(item);
            }
            resolve();
        });
        const hide = (...elements) => elements.forEach(el => el.style.display = 'none');
        createWrap(document.querySelector("#container")).then(res => {
            hide(...[...container.querySelectorAll(".wrap-item-img")].slice(2));
            [...container.querySelectorAll(".wrap-item")].slice(2).forEach(item => item.setAttribute("data-text", "占位符内容"));
        })
    </script>
</body>

</html>